﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using YouHP.Model.Group;

namespace YouHP.Pages.Group
{
    public class TopicDel : YouHP.Pages.Group.GroupBasePage
    {
        protected TopicInfo TopicData { get; set; }
        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;


            int tid = RequestTools.GetInt("tid", 0);
            TopicData = TopicBLL.Instance.GetTopicInfo(tid, GroupData.Id);
            if (TopicData.Id <= 0)
            {
                this.AddErrLine("该话题不存在");
                return;
            }


            bool succ = false;

            succ = TopicBLL.Instance.DeleteTopic(GroupData.Id, TopicData.Id,TopicData.PostUserId);
            if (succ == true)
            {
                this.Redirect("/Group/Group.aspx?gid=" + GroupData.Id);
            }
            else
            {
                this.AddErrLine("删除失败");
                return;
            }
        }

    }
}